package com.bhoethang.rabbit.config;

import org.springframework.amqp.core.*;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * @author EDZ
 */
//@Configuration
public class RabbitConfig {
    private static final String EXCHANGE = "order_exchange";
    private static final String QUEUE="order_queue";

   // @Bean
    public Exchange nbaExchange(){
        return ExchangeBuilder.topicExchange(EXCHANGE).durable(false).build();
    }

   // @Bean
    public Queue nbaQueue(){
        return QueueBuilder.durable(QUEUE).build();
    }

   // @Bean
    public Binding nbaBinding(Exchange exchange, Queue queue){
        return BindingBuilder.bind(queue).to(exchange).with("order.#").noargs();
    }

   // @Bean
    public MessageConverter messageConverter(){
        return new Jackson2JsonMessageConverter();
    }

}
